import util.*;

class util.HashMap 
{
	private var entries:Array;
	
	public function HashMap() 
	{
		entries = new Array();
	}
	
	public function clear():Void
	{
		entries = new Array();
	}
	
	public function containsKey(key:Object):Boolean
	{
		for (var i : Number = 0; i < entries.length; i++) 
			if(entries[i].getKey() == key)
				return true;
		return false;
	}
	
	public function containsValue(value:Object):Boolean
	{
		for (var i : Number = 0; i < entries.length; i++) 
			if(entries[i].getValue() == value)
				return true;
		return false;
	}
	
	public function get(key:Object):Object
	{
		for (var i : Number = 0; i < entries.length; i++) 
			if(entries[i].getKey() == key)
				return entries[i].getValue();
		return null;
	}
	
	public function put(key:Object, value:Object):Void
	{
		if(!containsKey(key))
			entries.push(new Entry(key,value));
		else
			for (var i : Number = 0; i < entries.length; i++)
				if(entries[i].getKey() == key)
					entries[i].setValue(value);
	}
	
	public function size():Number
	{
		return entries.length;
	}
	
	public function toString(Void): String 
	{
		return entries.toString();
	}
}
